Xi-Language Reference: Integration and Differentiation

    • derive (Computes the first derivative)
    • integrate (Integrates a function)

    derive (Computes the first derivative)

    Parameters

              derive ( x, y, value, tension = 0.0 )
    
              Types: x                      double[]
                     y                      double[]
                     value                  double[]
                     tension                double
    

    Return

              double[]  (first derivative at desired coordinates)
    

    Description

    The function derive differentiates a curve at a given point using a spline under tension. The curve is givin by x and y. The desired abscissa values are determined by the vector value. If tension is nearly zero the interpolation will be approximately a cubic spline. For increasing tension the result comes closer to a polygonal line. By default the function estimates internally the slopes at the two ends of the curve.

    Example

     (  1)>x=dincarr(10)/3;
     (  2)>y={2,4,3,2,5,4,7,5,4,7};
     (  3)>value=x;
     (  4)>print(derive(x,y,value));
     <dblarr>
             10.5  1.162708102 -6.150832408  5.440621532  2.388346282  3.005993341 
      3.587680355 -8.356714761   2.83917869           15 
    

    See also

    derive

    integrate (Integrates a function)

    Parameters

              integrate ( x, y, start, end, tension = 0.0, period = 0.0 )
    
              Types: x                      double[]
                     y                      double[]
                     start                  double
                     end                    double
                     tension                double
                     period                 double
    

    Return

              double  (value of the integral)
    

    Description

    integrate integrates a function specified by a spline under tension between two given limits. The curve is givin by x and y. If tension is nearly zero the interpolation will be approximately a cubic spline. For increasing tension the result comes closer to apolygonal line. By default the function estimates internally the slopes at thetwo ends of the curve. period is set integrate uses a periodic interpolatory spline with this period.

    Example

     (  1)>x=interval(0,6.28,20);
     Function interval defined
     (  2)>y=sin(x);
     (  3)>print(integrate(x,y,0,~pi));
     <double> 2.00023
     (  4)>print(integrate(x,y,0,~pi,\tension=10));
     <double> 1.99132
     (  5)>print(integrate(x,y,0,~pi,\period=2*~pi));
     <double> 1.99997
    

    See also

    integrate
    © 1995 by Bodo Junglas, Klaus Spanderen and Fabian Weis
    - Last revised: Wed Jun 19 16:58:32 1996